<UserControl
    x:Class="CodeShow.CS.Shared.ViewBoxDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CodeShow.CS.Shared"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <!--BeginCutPaste-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="150" />
            <RowDefinition Height="50" />
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="1" Grid.Column="1" Background="Gray">
            <Grid 
                x:Name="textGrid"
                Width="{Binding Value, ElementName=textScaleSlider}"
                Height="{Binding ActualHeight, ElementName=richText}"
                Background="LightBlue">
                <Viewbox>
                    <RichTextBlock x:Name="richText" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Paragraph Foreground="Blue" FontSize="18">
                            <Run Text="Paragraph one run one" />
                            <LineBreak />
                            <Run Text="Paragraph one run Two" />
                        </Paragraph>
                        <Paragraph Foreground="Red" FontSize="24">
                            <Run Text="Paragraph" />
                            <Run Text=" two " FontWeight="ExtraBold" Foreground="Black" />
                            <Run Text="run one" FontStyle="Italic" Foreground="DarkGreen" />
                            <LineBreak />
                            <Run Text="Paragraph two run Two" />
                        </Paragraph>
                    </RichTextBlock>
                </Viewbox>
            </Grid>
        </Grid>
        <Slider 
            x:Name="textScaleSlider" 
            Grid.Row="3" 
            Grid.Column="1" 
            Minimum="100" 
            Maximum="300"
            SnapsTo="Ticks"
            TickFrequency="1"
            Value="200"
            Width="300"
            Height="45"/>
    </Grid>
    <!--EndCutPaste-->
</UserControl>
